#!/usr/bin/perl 
use DBI;
use CGI;
# use TTrakerSite;
use TTraker;

print_header();
& initialize_dbi();

$query = CGI->new;
$loc = $query->param('loc');

write_employee_list ($loc);

db_disconnect();

##################### SUBROUTINES FOLLOW  #####################

sub write_employee_list
{
 my $empList_ref = get_full_employee_list ($loc);
 my @empList = @$empList_ref;

  print <<ENDHEADER;
  <html>
  <head>
  <link rel='stylesheet' type='text/css' href='${css_ref}trak.css' />
  <script type='text/javascript' src='${js_ref}trak.js'></script>
  <title>trak_03_employee_list.pl</title>
  </head>
  <body>
  <table id="small">
    <tr>
      <th id="warn">Emp #</th>
      <th id="warn">Name</th>
    </tr>
ENDHEADER
	for $i (0..$#empList ) {
		my $num = $empList[$i][0];
	  	my $name = $empList[$i][1];
   print <<ENDHEADER;
   <tr>
     <td><b>&nbsp&nbsp&nbsp $num</b></td>
     <td><b>&nbsp&nbsp&nbsp $name</td>
   </tr>
ENDHEADER
}
print <<ENDHEADER;
	<tr>
     <td><b>&nbsp&nbsp&nbsp</b></td>
     <td><b>&nbsp&nbsp&nbsp</b></td>
   </tr>
  </table>
 </form>
 </body>
 </html>
ENDHEADER
}


